//后端传来的IO流,解析为图片
//传入服务器地址URL
export default (url) => new Promise((resolve, reject) => {
	uni.request({
		url: url,
		responseType: 'arraybuffer',
		method: 'POST',
		success: (res) => {
			let binary = ''
			let bytes = new Uint8Array(res.data)
			let len = bytes.byteLength
			for (let i = 0; i < len; i++) {
				binary += String.fromCharCode(bytes[i])
			}
			let imgUrl = 'data:image/jpeg;base64,' + window.btoa(binary)
			resolve(res)
		},
		fail: (rej) => {
			reject(rej)
		}
	});
})
